<template>
  <el-table :data="patients" style="width: 100%">
    <el-table-column prop="caseNumber" label="病历号"/>
    <el-table-column prop="realName" label="真实姓名"/>
    <el-table-column prop="gender" label="性别"/>
    <el-table-column prop="birthday" label="出生日期"/>
    <el-table-column prop="age" label="年龄"/>
    <el-table-column prop="homeAddress" label="家庭住址"/>
    <el-table-column prop="visitDate" label="就诊日期"/>
    <el-table-column prop="noon" label="午别"/>
    <el-table-column label="操作" prop="id">
      <template #default="scope">
        <el-button
            plain
            type="primary"
            size="small"
            @click="createMedicalRecord(scope.$index, scope.row)">
          创建病历
        </el-button>
        <el-button
            plain
            type="primary"
            size="small"
            @click="skip(scope.$index, scope.row)">
          跳过
        </el-button>
        <el-button
            plain
            type="primary"
            size="small"
            @click="call(scope.$index, scope.row)">
          叫号
        </el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import axios from "axios"

export default {
  name: "PhysicianPatientView",
  data() {
    return {
      patients: []
    }
  },
  methods: {
    createMedicalRecord(index, row) {
      this.$store.commit("setCurrentPatient", row)
      this.$router.push({
        name: "medical-record"
      });
    },
    skip(index, row) {

    },
    call(index, row) {

    }
  },
  mounted() {
    axios({
      url: "/api/register/query",
      method: "post",
      data: {}
    }).then(res => {
      this.patients = res.data.data
    }).catch(err => {
    }).then(() => {
    })
  }
}
</script>

<style scoped>

</style>